package com.gitee.linmt.controller;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.web.bind.annotation.*;

/**
 * @author linmt
 */
@RestController
@RequestMapping("/userInfo")
public class UserInfoController {

    /**
     * 用户查询
     * 需要 administrator 角色
     */
    @GetMapping("/userList")
    @RequiresRoles("administrator")
    public String userInfo() {
        return "userInfo";
    }

    /**
     * 添加用户
     * 需要 userInfo:add 权限
     */
    @PostMapping("/userAdd")
    @RequiresPermissions("userInfo:add")
    public String userInfoAdd() {
        return "userInfoAdd";
    }

    /**
     * 不需要权限
     */
    @GetMapping("/getSelfInfo")
    public String userSearch() {
        return "selfInfo";
    }
}